<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
<title>会员中心-{$web_config['web_title']}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="renderer" content="webkit">
<link href="/assets/css/frontend.min.css?v=1.0.1" rel="stylesheet">

<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
  <script src="/assets/js/html5shiv.js"></script>
  <script src="/assets/js/respond.min.js"></script>
<![endif]-->
        <link href="/assets/css/user.css?v=1.0.1" rel="stylesheet">
		<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
	<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/ueditor/lang/zh-cn/zh-cn.js"></script>
    </head>

    <body>
        {include file="header"}
        <main class="content">
            <style>
    .basicinfo {
        margin: 15px 0;
    }

    .basicinfo .row > .col-xs-4 {
        padding-right: 0;
    }

    .basicinfo .row > div {
        margin: 5px 0;
    }
</style>
<div id="content-container" class="container">
    <div class="row">
        {include file="user_left"}





<div class="col-md-10">

      <div class="panel panel-default ">
        <div class="panel-body">
          <div id="myTabContent" class="tab-content">
		  <h2 class="page-header">任务内容</h2>
          <div class="tab-pane fade active in" id="one">
          <form name="form" role="form" id="adds-form" class="form-horizontal" method="POST" action="">

			
			<div class="form-group">
              <label class="control-label col-xs-2 col-sm-2">平台名称:</label>
              <div class="col-xs-4 col-sm-4">
                 <div>{$info['tpf_title']}</div>
              </div>
			  <label class="control-label col-xs-2 col-sm-2">任务类型:</label>
              <div class="col-xs-4 col-sm-4">
                <div >{$info['tt_title']}</div>
              </div> 
            </div>
			
			
			<div class="form-group">
              <label class="control-label col-xs-12 col-sm-2">店铺名称:</label>
              <div class="col-xs-12 col-sm-10">
                <div>{$info['t_dp_name']}</div>
              </div>
            </div>
			
			<div class="form-group">
              <label class="control-label col-xs-12 col-sm-2">链接网址:</label>
              <div class="col-xs-12 col-sm-10">
                <div>{$info['t_url']}</div>
              </div>
            </div>
			<hr>
			<div class="form-group">
              <label class="control-label col-xs-2 col-sm-2">任务数量:</label>
              <div class="col-xs-4 col-sm-4">
                 <div>{$info['t_count']} 个</div>
              </div>
			  <label class="control-label col-xs-2 col-sm-2">任务单价:</label>
              <div class="col-xs-4 col-sm-4">
                <div >{$info['t_money']} 元</div>
              </div> 
            </div>
			
			<div class="form-group">
              <label class="control-label col-xs-2 col-sm-2">任务余数:</label>
              <div class="col-xs-4 col-sm-4">
                 <div>{$info['t_y_count']} 个</div>
              </div>
			  <label class="control-label col-xs-2 col-sm-2">任务余价:</label>
              <div class="col-xs-4 col-sm-4">
                <div>{$info['t_y_money']} 元</div>
              </div> 
            </div>
			
			<hr>

            <div class="form-group">
              <label class="control-label col-xs-12 col-sm-2">任务描述:</label>
              <div class="col-xs-12 col-sm-8">
                <div>{$info['t_desc']}</div>
              </div>
            </div>	  	
          </form>
          </div>
          </div>
          </div>
      </div>
      
      
     

      
         <!-- 提交任务 -->
         {if $info['u_id'] != $userinfo['u_id']}
        {if empty($task_order)}
		<div class="panel panel-default ">
			<div class="panel-body">
				<div id="myTabContent" class="tab-content">
					<h2 class="page-header">提交任务</h2>
					<div class="tab-pane fade active in" id="one">
                    	<form name="form" role="form" id="adds-form" class="form-horizontal" method="POST" action="">
						<div class="form-group">
						  <div class="col-xs-12 col-sm-12">
							<script id="editor" type="text/plain" style="width:100%;height:200px;"></script>
						  </div>
						</div>
                        
                        <div class="form-group layer-footer">
                          <label class="control-label col-xs-12 col-sm-2"></label>
                          <div class="col-xs-12 col-sm-4">
                            <!--<button type="button" class="btn btn-danger btn-dialog">检查格式</button>-->
                            <div type="submit" class="btn btn-success btn-embossed subok">提交任务</div>
                          </div>
                        </div>
                        </form>
                        
					</div>
                    
				</div>
			</div>
		</div>
        {else}
         <!-- 提交任务 -->
		<!-- 用户结果 -->
	   <div class="panel panel-default ">
			<div class="panel-body">
				<div id="myTabContent" class="tab-content">
					<div class="tab-pane fade active in" id="one">
						<form name="form" role="form" id="adds-form" class="form-horizontal" method="POST" action="">
						.<div class="form-group">
						  <label class="control-label col-xs-12 col-sm-2">用户名称:</label>
						  <div class="col-xs-12 col-sm-8">
							<div>{$task_order['u_phone']}</div>
						  </div>
						</div>

						<div class="form-group">
						  <label class="control-label col-xs-12 col-sm-2">任务结果:</label>
						  <div class="col-xs-12 col-sm-8">
							<div>{$task_order['to_desc']}</div>
						  </div>
						</div>
						</form>
					</div>
				</div>
			</div>
		</div>
        <!-- 提交任务 -->
        {/if}
        {/if}
		
		
		<!-- 用户结果 -->
        {volist name="task_select" id="vo"}
	   <div class="panel panel-default ">
			<div class="panel-body">
				<div id="myTabContent" class="tab-content">
                	{if $info['u_id'] != $userinfo['u_id']}
					<div class="tab-pane fade active in" id="one">
						  <label class="control-label col-xs-12 col-sm-12">非任务发布者，无法查看结果！</label>
					</div>
                    {else}
                    <div class="tab-pane fade active in" id="one">
						<form name="form" role="form" id="adds-form" class="form-horizontal" method="POST" action="">
						.<div class="form-group">
						  <label class="control-label col-xs-12 col-sm-2">用户名称:</label>
						  <div class="col-xs-12 col-sm-8">
							<div>{$vo.u_phone} &nbsp; &nbsp; {if $vo.to_status==4}<strong><font color="#009900">[确认完成任务]</font></strong>{/if}</div>
						  </div>
						</div>
						<div class="form-group">
                        	<label class="control-label col-xs-12 col-sm-2"></label>
						  <div class="col-xs-12 col-sm-8">
							<div>{$vo.to_desc}</div>
						  </div>
						</div>
                        {if $vo.to_status==2}
                        <div class="form-group layer-footer">
                          <label class="control-label col-xs-12 col-sm-2"></label>
                          <div class="col-xs-12 col-sm-4">
                            <!--<button type="button" class="btn btn-danger btn-dialog">检查格式</button>-->
                            <div type="submit" class="btn btn-success btn-embossed" onClick="subokuser({$vo.to_id})">确认用户完成任务</div>
                          </div>
                        </div>
                        {/if}
						</form>
					</div>
                    {/if}
				</div>
			</div>
		</div>
        {/volist}
        <!-- 提交任务 -->
		
      
    </div>
    </div>
</div>
        </main>
		{include file="footer_content"}
<script>
var ue = UE.getEditor('editor');

function subokuser(id)
{	
	$.ajax({
		type:"POST",
		url:"{:url('task/subokuser')}",
		dataType:"json",
		data:{
			t_id:{$info['t_id']},
			id:id,
		},
		success:function(res){
			if(res.status == "success"){
				window.location.reload();
			}else{
				alert(res.data);
			}
		},
		error:function(jqXHR){
			console.log("Error: "+jqXHR.status);
		},
	});
	
}





$(".subok").click(function(){
	var editor = UE.getEditor('editor').getContent();

	if(editor ==""){
		alert("提交任务内容不能为空！");
		return false;
	}
	

	
	$.ajax({
		type:"POST",
		url:"{:url('task/sub')}",
		dataType:"json",
		data:{
			t_id:{$info['t_id']},
			money:"{$info['t_money']}",
			editor:editor,
		},
		success:function(res){
			if(res.status == "success"){
				window.location.reload();
			}else{
				alert(res.data);
			}
		},
		error:function(jqXHR){
			console.log("Error: "+jqXHR.status);
		},
	});
	
});
</script>
    </body>
</html>